export default {
	getPageList() {
		let that = this
		that.$httpRequest.get({
			that: that,
			url: 'wechat/getAllSystemMessage',
			params: {
				pageNo: that.page,
				pageSize: that.list_rows,
			},
			success: res => {
				that.loading = false
				if (res.code === that.$httpConfig.SUCCESS_CODE) {

					if (that.page === 1) {
						that.list = res.data
					} else {
						that.list = that.list.concat(res.data)
					}
					console.log(that.list)
					that.page++
				} else {

				}
			}
		})
	},
	readMessage(id) {
		let that = this
		that.$httpRequest.request({
			that,
			url: 'wechat/readMessageSystem',
			method: 'get',
			params: {
				id: id
			},
			success: res => {
				if (res.code === that.$httpConfig.SUCCESS_CODE) {


				} else {
					that.$toast.alert({
						content: res.message,
						callback: result => {
							if (result.confirm) {
								uni.navigateBack({
									delta: 1
								})
							}
						}
					})
				}
			}
		}, false)
	},
	toSystemDetail(id, item) {
		if (item.type == 2) {
			this.$toast.msg('已读该消息', {
				icon: 1
			})
			item.readStatus = true
			this.readMessage(id)
			return false
		}
		uni.navigateTo({
			url: '/pages/index/systemDetail?id=' + id
		})
	}
}